﻿namespace CSharpPro._1020._2;

public class Student
    {
        public string StudentId { get; set; }  
        public string Name { get; set; }       
        public int Age { get; set; }           
        public string Gender { get; set; }     
        public string ClassName { get; set; }  
        
        private Dictionary<string, double> _scores = new Dictionary<string, double>();
        
        public Student(string studentId, string name)
        {
            StudentId = studentId;
            Name = name;
        }
        
        public void SetScore(string course, double score)
        {
            _scores[course] = score; 
        }
        
        public double? GetScore(string course)
        {
            return _scores.TryGetValue(course, out double score) ? score : null;
        }
        
        public void ShowInfo()
        {
            Console.WriteLine($"学号：{StudentId}");
            Console.WriteLine($"姓名：{Name}");
            Console.WriteLine($"年龄：{Age}  性别：{Gender}");
            Console.WriteLine($"班级：{ClassName}");
        }
} 